/*
 * QLyTVView.java
 */
package qlytv;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.table.DefaultTableModel;

import com.connDB4o.*;
import com.constants.Constant;
import com.datatype.Docgia;
import com.datatype.NhanVien;
import com.db4o.ObjectContainer;
import com.db4o.ObjectSet;
import com.db4o.query.Query;
import javax.swing.JOptionPane;

/**
 * The application's main frame.
 */
public class QLyTVView extends FrameView {
    //mode default table

    DefaultTableModel model = null;
    private int rows;
    //flag search: first search    
    String flag = "";

    public QLyTVView(SingleFrameApplication app) {
        super(app);

        initComponents();

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String) (evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer) (evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
        txtMaNV.setEnabled(false);
        //Display info NhanVien
        viewTblNhanVien();
        displayNhanVien();

        //Display info DocGia
        viewTblDocGia();
        displayDocGia();

    }

    /**
     * display info NhanVien
     */
    public void viewTblNhanVien() {
        //set header column
        model = new DefaultTableModel();
        model.addColumn("Mã NV");
        model.addColumn("Họ tên");
        model.addColumn("Ngày sinh");
        model.addColumn("Địa chỉ");
        model.addColumn("Mobile");
        model.addColumn("Email");
        model.addColumn("Chức vụ");
        model.addColumn("Phòng ban");
        model.addColumn("Giới tính");
        ObjectContainer db = ConnectDB4o.connDB4o(Constant.DB4OFILENAME_NHANVIEN);
        ObjectSet<NhanVien> result = db.query(NhanVien.class);
        try {
            while (result.hasNext()) {
                NhanVien nv = (NhanVien) result.next();
                //get values to form
                String rows[] = {nv.getMaNV(), nv.getHoten(), nv.getNgaysinh(), nv.getDiachi(), nv.getMobile(), nv.getEmail(), nv.getChucvu(), nv.getPhongban(), nv.getGioitinh()};
                model.addRow(rows);
                tblNhanVien.setModel(model);

            }
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            db.close();
        }

    }

    /**
     * display info NhanVien
     */
    public void viewTblDocGia() {
        //set header column
        model = new DefaultTableModel();
        model.addColumn("Họ tên");
        model.addColumn("Ngày sinh");
        model.addColumn("Địa chỉ");
        model.addColumn("Mobile");
        model.addColumn("Email");
        model.addColumn("Giới tính");
        model.addColumn("Mã thẻ");
        model.addColumn("Trạng thái thẻ");
        ObjectContainer db = ConnectDB4o.connDB4o(Constant.DB4OFILENAME_DOCGIA);
        ObjectSet<Docgia> result = db.query(Docgia.class);
        try {
            while (result.hasNext()) {
                Docgia dg = (Docgia) result.next();
                //get values to form
                String rows[] = {dg.getHoten(), dg.getNgaysinh(), dg.getDiachi(), dg.getMobile(), dg.getEmail(), dg.getGioitinh(), dg.getMathe(), dg.getTrangthaithe()};
                model.addRow(rows);
                tblDocGia.setModel(model);

            }
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            db.close();
        }

    }

    /**
     * search NhanVien
     */
    @Action
    public void findNhanVien() {
        if (flag.isEmpty()) {
            clearNhanVien();
            flag = "X";
        } else {
            //find this NhanVien
            NhanVien nv_ = inputNhanVien();
            //set header column
            model = new DefaultTableModel();
            model.addColumn("Mã NV");
            model.addColumn("Họ tên");
            model.addColumn("Ngày sinh");
            model.addColumn("Địa chỉ");
            model.addColumn("Mobile");
            model.addColumn("Email");
            model.addColumn("Chức vụ");
            model.addColumn("Phòng ban");
            model.addColumn("Giới tính");

            //open data
            ObjectContainer db = ConnectDB4o.connDB4o(Constant.DB4OFILENAME_NHANVIEN);
            ObjectSet result = null;
            try {
                Query query = db.query();
                query.constrain(NhanVien.class);

                if (txtMaNV.getText().isEmpty()) {
                    query.descend("MaNV").constrain("").like();
                } else {
                    query.descend("MaNV").constrain(nv_.getMaNV()).like();
                }

                if (txtHoten.getText().isEmpty()) {
                    query.descend("Hoten").constrain("").like();
                } else {
                    query.descend("Hoten").constrain(nv_.getHoten()).like();
                }


                if (txtNgaysinh.getText().isEmpty()) {
                    query.descend("Ngaysinh").constrain("").like();
                } else {
                    query.descend("Ngaysinh").constrain(nv_.getNgaysinh()).like();
                }

                if (txtDiachi.getText().isEmpty()) {
                    query.descend("Diachi").constrain("").like();
                } else {
                    query.descend("Diachi").constrain(nv_.getDiachi()).like();

                }
                if (txtMobi.getText().isEmpty()) {
                    query.descend("Mobile").constrain("").like();
                } else {
                    query.descend("Mobile").constrain(nv_.getMobile()).like();
                }
                if (txtEmail.getText().isEmpty()) {
                    query.descend("Email").constrain("").like();
                } else {
                    query.descend("Email").constrain(nv_.getEmail()).like();
                }

                if (txtCV.getText().isEmpty()) {
                    query.descend("Chucvu").constrain("").like();
                } else {
                    query.descend("Chucvu").constrain(nv_.getChucvu()).like();
                }

                if (txtPB.getText().isEmpty()) {
                    query.descend("Phongban").constrain("").like();
                } else {
                    query.descend("Phongban").constrain(nv_.getPhongban()).like();
                }


                query.descend("Gioitinh").constrain(cboSex.getSelectedItem()).like();


                result = query.execute();

                if (result.size() > 0) {
                    while (result.hasNext()) {
                        NhanVien nv = (NhanVien) result.next();
                        //get values to form
                        String rows[] = {nv.getMaNV(), nv.getHoten(), nv.getNgaysinh(), nv.getDiachi(), nv.getMobile(), nv.getEmail(), nv.getChucvu(), nv.getPhongban(), nv.getGioitinh()};
                        model.addRow(rows);
                        tblNhanVien.setModel(model);
                    }
                } else {
                    String rows[] = {"", "", "", "", "", "", "", "", ""};
                    model.addRow(rows);
                    tblNhanVien.setModel(model);
                }

            } catch (Exception ex) {
                ex.printStackTrace();
            } finally {
                db.close();
            }
        }
    }

    /**
     * search Docgia
     */
    @Action
    public void findDocgia() {
        if (flag.isEmpty()) {
            clearDocGia();
            flag = "X";
        } else {
            //find this Docgia
            Docgia nv_ = inputDocGia();
            //set header column
            model = new DefaultTableModel();
            model.addColumn("Họ tên");
            model.addColumn("Ngày sinh");
            model.addColumn("Địa chỉ");
            model.addColumn("Mobile");
            model.addColumn("Email");
            model.addColumn("Giới tính");
            model.addColumn("Mã thẻ");
            model.addColumn("Trạng thái thẻ");

            //open data
            ObjectContainer db = ConnectDB4o.connDB4o(Constant.DB4OFILENAME_DOCGIA);
            ObjectSet result = null;
            try {
                Query query = db.query();
                query.constrain(Docgia.class);
                
                if (txtHoten1.getText().isEmpty()) {
                    query.descend("Hoten").constrain("").like();
                } else {
                    query.descend("Hoten").constrain(nv_.getHoten()).like();
                }


                if (txtNgaysinh1.getText().isEmpty()) {
                    query.descend("Ngaysinh").constrain("").like();
                } else {
                    query.descend("Ngaysinh").constrain(nv_.getNgaysinh()).like();
                }

                if (txtDiachi1.getText().isEmpty()) {
                    query.descend("Diachi").constrain("").like();
                } else {
                    query.descend("Diachi").constrain(nv_.getDiachi()).like();

                }
                if (txtMobi1.getText().isEmpty()) {
                    query.descend("Mobile").constrain("").like();
                } else {
                    query.descend("Mobile").constrain(nv_.getMobile()).like();
                }
                if (txtEmail1.getText().isEmpty()) {
                    query.descend("Email").constrain("").like();
                } else {
                    query.descend("Email").constrain(nv_.getEmail()).like();
                }

                if (txtMaNV.getText().isEmpty()) {
                    query.descend("Mathe").constrain("").like();
                } else {
                    query.descend("Mathe").constrain(nv_.getMathe()).like();
                }

                if (txtPB.getText().isEmpty()) {
                    query.descend("Trangthaithe").constrain("").like();
                } else {
                    query.descend("Trangthaithe").constrain(nv_.getTrangthaithe()).like();
                }


                query.descend("Gioitinh").constrain(cboSex.getSelectedItem()).like();


                result = query.execute();

                if (result.size() > 0) {
                    while (result.hasNext()) {
                        Docgia dg = (Docgia) result.next();
                        //get values to form
                        String rows[] = {dg.getHoten(), dg.getNgaysinh(), dg.getDiachi(), dg.getMobile(), dg.getEmail(), dg.getGioitinh(), dg.getMathe(), dg.getTrangthaithe()};
                        model.addRow(rows);
                        tblDocGia.setModel(model);
                    }
                } else {
                    String rows[] = {"", "", "", "", "", "", "", ""};
                    model.addRow(rows);
                    tblDocGia.setModel(model);
                }

            } catch (Exception ex) {
                ex.printStackTrace();
            } finally {
                db.close();
            }
        }
    }

    /**
     * display info NhanVien
     */
    public void displayNhanVien() {
        //open data
        ObjectContainer db = ConnectDB4o.connDB4o(Constant.DB4OFILENAME_NHANVIEN);
        ObjectSet<NhanVien> result = db.query(NhanVien.class);
        try {
            while (result.hasNext()) {
                NhanVien nv = (NhanVien) result.next();
                //get values to form
                txtMaNV.setText(nv.getMaNV());

                txtCV.setText(nv.getChucvu());

                txtDiachi.setText(nv.getDiachi());

                txtEmail.setText(nv.getEmail());

                txtMobi.setText(nv.getMobile());

                txtHoten.setText(nv.getHoten());

                txtNgaysinh.setText(nv.getNgaysinh());

                txtPB.setText(nv.getPhongban());

                if (tblNhanVien.getModel().getValueAt(rows, 8).equals("Nữ")) {
                    cboSex.setSelectedIndex(1);
                } else {
                    cboSex.setSelectedIndex(0);
                }

                break;
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            db.close();
        }

    }

    /**
     * display info DocGia
     */
    public void displayDocGia() {
        //open data
        ObjectContainer db = ConnectDB4o.connDB4o(Constant.DB4OFILENAME_DOCGIA);
        ObjectSet<Docgia> result = db.query(Docgia.class);
        try {
            while (result.hasNext()) {
                Docgia dg = (Docgia) result.next();
                //get values to form
                txtMaThe.setText(dg.getMathe());

                txtTTThe.setText(dg.getTrangthaithe());

                txtDiachi1.setText(dg.getDiachi());

                txtEmail1.setText(dg.getEmail());

                txtMobi1.setText(dg.getMobile());

                txtHoten1.setText(dg.getHoten());

                txtNgaysinh1.setText(dg.getNgaysinh());

                if (tblDocGia.getModel().getValueAt(rows, 5).equals("Nữ")) {
                    cboSex1.setSelectedIndex(1);
                } else {
                    cboSex1.setSelectedIndex(0);
                }

                break;
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            db.close();
        }

    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = QLyTVApp.getApplication().getMainFrame();
            aboutBox = new QLyTVAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        QLyTVApp.getApplication().show(aboutBox);
    }

    @Action
    public void showPhongBan() {
        if (showPhongBan == null) {
            JFrame mainFrame = QLyTVApp.getApplication().getMainFrame();
            showPhongBan = new DMPhongBan(mainFrame);
            showPhongBan.setLocationRelativeTo(mainFrame);
        }
        QLyTVApp.getApplication().show(showPhongBan);
    }

    @Action
    public void showThe() {
        if (showThe == null) {
            JFrame mainFrame = QLyTVApp.getApplication().getMainFrame();
            showThe = new DMThe(mainFrame);
            showThe.setLocationRelativeTo(mainFrame);
        }
        QLyTVApp.getApplication().show(showThe);
    }

    /**
     * get data on Form
     * @return NhanVien
     */
    public NhanVien inputNhanVien() {
        NhanVien nv = new NhanVien();

        nv.setMaNV(txtMaNV.getText());
        nv.setChucvu(txtCV.getText());
        nv.setDiachi(txtDiachi.getText());
        nv.setEmail(txtEmail.getText());
        nv.setGioitinh(cboSex.getSelectedItem().toString());
        nv.setHoten(txtHoten.getText());
        nv.setMobile(txtMobi.getText());
        nv.setNgaysinh(txtNgaysinh.getText());
        nv.setPhongban(txtPB.getText());

        return nv;
    }

    /**
     * get data on Form
     * @return NhanVien
     */
    public Docgia inputDocGia() {
        Docgia dg = new Docgia();

        dg.setMathe(txtMaThe.getText());
        dg.setTrangthaithe(txtTTThe.getText());

        dg.setDiachi(txtDiachi1.getText());
        dg.setEmail(txtEmail1.getText());
        dg.setGioitinh(cboSex1.getSelectedItem().toString());
        dg.setHoten(txtHoten1.getText());
        dg.setMobile(txtMobi1.getText());
        dg.setNgaysinh(txtNgaysinh1.getText());


        return dg;
    }

    /**
     * Clear textbox
     */
    public static void outNhanVien() {
        txtMaNV.setText("");
        txtCV.setText("");
        txtDiachi.setText("");
        txtEmail.setText("");
        cboSex.getSelectedItem().toString();
        txtMobi.setText("");
        txtHoten.setText("");
        txtNgaysinh.setText("");
        txtPB.setText("");
    }

    /**
     * Clear textbox
     */
    public static void outDocGia() {
        txtMaThe.setText("");
        txtTTThe.setText("");

        txtDiachi1.setText("");
        txtEmail1.setText("");
        cboSex1.getSelectedItem().toString();
        txtMobi1.setText("");
        txtHoten1.setText("");
        txtNgaysinh1.setText("");
    }

    /**
     * Clear screen. disable, enable
     */
    @Action
    public void clearNhanVien() {

        txtMaNV.setEnabled(true);
        outNhanVien();
        //disable and enable
        btnInsert.setEnabled(false);
        btnDelete.setEnabled(false);
        btnSearch.setEnabled(true);
        btnUpdate.setEnabled(false);
        btnSave.setEnabled(true);
    }

    /**
     * Clear screen. disable, enable
     */
    @Action
    public void clearDocGia() {
        outDocGia();
        //disable and enable
        btnInsert1.setEnabled(false);
        btnDelete1.setEnabled(false);
        btnSearch1.setEnabled(true);
        btnUpdate1.setEnabled(false);
        btnSave1.setEnabled(true);
    }

    /**
     * Insert NhanVien
     */
    @Action
    public void insNhanVien() {

        if (txtMaNV.getText().isEmpty()) {
            //message dialog
            JOptionPane.showMessageDialog(null, "Mã NV không được trống.", "Nhập thông tin", JOptionPane.INFORMATION_MESSAGE);
            //set focus
            txtMaNV.requestFocus();
        } else {
            NhanVien nv = inputNhanVien();
            String flag = ConnectDB4o.insertData(Constant.DB4OFILENAME_NHANVIEN, nv, null, null, null);

            //disable and enable
            btnInsert.setEnabled(true);
            btnDelete.setEnabled(true);
            btnSearch.setEnabled(true);
            btnUpdate.setEnabled(true);
            btnSave.setEnabled(false);
            txtMaNV.setEnabled(false);
            if (flag.isEmpty()) {
                btnSave.setEnabled(true);
                txtMaNV.setEnabled(true);
            }
            //Hien thi bang Nhan vien len luoi
            viewTblNhanVien();
        }
    }

    @Action
    public void insDocGia() {

        if (txtMaThe.getText().isEmpty()) {
            //message dialog
            JOptionPane.showMessageDialog(null, "Mã ther không được trống.", "Nhập thông tin", JOptionPane.INFORMATION_MESSAGE);
            //set focus
            txtMaThe.requestFocus();
        } else {
            Docgia dg = inputDocGia();
            String flag = ConnectDB4o.insertData(Constant.DB4OFILENAME_DOCGIA, null, null, null, dg);

            //disable and enable
            btnInsert1.setEnabled(true);
            btnDelete1.setEnabled(true);
            btnSearch1.setEnabled(true);
            btnUpdate1.setEnabled(true);
            btnSave1.setEnabled(false);
            txtMaThe.setEnabled(false);
            if (flag.isEmpty()) {
                btnSave1.setEnabled(true);
                txtMaThe.setEnabled(true);
            }
            //Hien thi bang Nhan vien len luoi
            viewTblDocGia();
        }
    }

    public static void showMessage(String mess) {
        JOptionPane.showMessageDialog(null, mess, "Kiểm tra lại nhân viên", JOptionPane.INFORMATION_MESSAGE);
        outNhanVien();
    }

    /**
     * update NhanVien
     */
    @Action
    public void updNhanVien() {

        NhanVien nv = inputNhanVien();
        ConnectDB4o.updateData(Constant.DB4OFILENAME_NHANVIEN, nv, null, null, null);

        //disable and enable
        btnInsert.setEnabled(true);
        btnDelete.setEnabled(true);
        btnSearch.setEnabled(true);
        btnUpdate.setEnabled(true);
        btnSave.setEnabled(false);

        //Hien thi bang Nhan vien len luoi
        viewTblNhanVien();

    }

    /**
     * update DocGia
     */
    @Action
    public void updDocGia() {

        Docgia dg = inputDocGia();
        ConnectDB4o.updateData(Constant.DB4OFILENAME_DOCGIA, null, null, null, dg);

        //disable and enable
        btnInsert.setEnabled(true);
        btnDelete.setEnabled(true);
        btnSearch.setEnabled(true);
        btnUpdate.setEnabled(true);
        btnSave.setEnabled(false);

        //Hien thi bang Docgia len luoi
        viewTblDocGia();

    }

    /**
     * delete NhanVien
     */
    @Action
    public void delNhanVien() {

        ConnectDB4o.delData(Constant.DB4OFILENAME_NHANVIEN, txtMaNV.getText());
        //disable and enable
        btnInsert.setEnabled(true);
        btnDelete.setEnabled(true);
        btnSearch.setEnabled(true);
        btnUpdate.setEnabled(true);
        btnSave.setEnabled(false);

        //Hien thi bang Nhan vien len luoi
        viewTblNhanVien();
    }

    /**
     * delete Docgia
     */
    @Action
    public void delDocGia() {

        ConnectDB4o.delData(Constant.DB4OFILENAME_DOCGIA, txtMaThe.getText());
        //disable and enable
        btnInsert.setEnabled(true);
        btnDelete.setEnabled(true);
        btnSearch.setEnabled(true);
        btnUpdate.setEnabled(true);
        btnSave.setEnabled(false);

        //Hien thi bang Docgia len luoi
        viewTblDocGia();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        lblMaNV = new javax.swing.JLabel();
        txtMaNV = new javax.swing.JTextField();
        lbl = new javax.swing.JLabel();
        txtHoten = new javax.swing.JTextField();
        lblMaNV1 = new javax.swing.JLabel();
        lblMaNV4 = new javax.swing.JLabel();
        txtDiachi = new javax.swing.JTextField();
        lblMaNV6 = new javax.swing.JLabel();
        txtMobi = new javax.swing.JTextField();
        lbl2 = new javax.swing.JLabel();
        txtEmail = new javax.swing.JTextField();
        lblMaNV3 = new javax.swing.JLabel();
        txtCV = new javax.swing.JTextField();
        lblMaNV2 = new javax.swing.JLabel();
        txtPB = new javax.swing.JTextField();
        lbl1 = new javax.swing.JLabel();
        cboSex = new javax.swing.JComboBox();
        txtNgaysinh = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        btnInsert = new javax.swing.JButton();
        btnDelete = new javax.swing.JButton();
        btnSearch = new javax.swing.JButton();
        btnSave = new javax.swing.JButton();
        btnUpdate = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblNhanVien = new javax.swing.JTable();
        jPanel5 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        lbl3 = new javax.swing.JLabel();
        txtHoten1 = new javax.swing.JTextField();
        lblMaNV7 = new javax.swing.JLabel();
        lblMaNV8 = new javax.swing.JLabel();
        txtDiachi1 = new javax.swing.JTextField();
        lblMaNV9 = new javax.swing.JLabel();
        txtMobi1 = new javax.swing.JTextField();
        lbl4 = new javax.swing.JLabel();
        txtEmail1 = new javax.swing.JTextField();
        lblMaNV10 = new javax.swing.JLabel();
        lblMaNV11 = new javax.swing.JLabel();
        txtTTThe = new javax.swing.JTextField();
        lbl5 = new javax.swing.JLabel();
        cboSex1 = new javax.swing.JComboBox();
        txtNgaysinh1 = new javax.swing.JTextField();
        txtMaThe = new javax.swing.JTextField();
        jPanel7 = new javax.swing.JPanel();
        btnInsert1 = new javax.swing.JButton();
        btnDelete1 = new javax.swing.JButton();
        btnSearch1 = new javax.swing.JButton();
        btnSave1 = new javax.swing.JButton();
        btnUpdate1 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblDocGia = new javax.swing.JTable();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        mnuDMPB = new javax.swing.JMenuItem();
        mnuDMThe = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();

        mainPanel.setName("mainPanel"); // NOI18N

        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jPanel1.setName("jPanel1"); // NOI18N

        jPanel4.setName("jPanel4"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(qlytv.QLyTVApp.class).getContext().getResourceMap(QLyTVView.class);
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        lblMaNV.setText(resourceMap.getString("lblMaNV.text")); // NOI18N
        lblMaNV.setName("lblMaNV"); // NOI18N

        txtMaNV.setToolTipText(resourceMap.getString("txtMaNV.toolTipText")); // NOI18N
        txtMaNV.setName("txtMaNV"); // NOI18N

        lbl.setText(resourceMap.getString("lbl.text")); // NOI18N
        lbl.setName("lbl"); // NOI18N

        txtHoten.setName("txtHoten"); // NOI18N

        lblMaNV1.setText(resourceMap.getString("lblMaNV1.text")); // NOI18N
        lblMaNV1.setName("lblMaNV1"); // NOI18N

        lblMaNV4.setText(resourceMap.getString("lblMaNV4.text")); // NOI18N
        lblMaNV4.setName("lblMaNV4"); // NOI18N

        txtDiachi.setName("txtDiachi"); // NOI18N

        lblMaNV6.setText(resourceMap.getString("lblMaNV6.text")); // NOI18N
        lblMaNV6.setName("lblMaNV6"); // NOI18N

        txtMobi.setName("txtMobi"); // NOI18N

        lbl2.setText(resourceMap.getString("lbl2.text")); // NOI18N
        lbl2.setName("lbl2"); // NOI18N

        txtEmail.setName("txtEmail"); // NOI18N

        lblMaNV3.setText(resourceMap.getString("lblMaNV3.text")); // NOI18N
        lblMaNV3.setName("lblMaNV3"); // NOI18N

        txtCV.setName("txtCV"); // NOI18N

        lblMaNV2.setText(resourceMap.getString("lblMaNV2.text")); // NOI18N
        lblMaNV2.setName("lblMaNV2"); // NOI18N

        txtPB.setName("txtPB"); // NOI18N

        lbl1.setText(resourceMap.getString("lbl1.text")); // NOI18N
        lbl1.setName("lbl1"); // NOI18N

        cboSex.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Nam", "Nữ", "" }));
        cboSex.setName("cboSex"); // NOI18N

        txtNgaysinh.setText(resourceMap.getString("txtNgaysinh.text")); // NOI18N
        txtNgaysinh.setName("txtNgaysinh"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblMaNV)
                            .addComponent(lblMaNV1)
                            .addComponent(lblMaNV6)
                            .addComponent(lbl1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtNgaysinh)
                            .addComponent(txtCV, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
                            .addComponent(cboSex, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtMobi, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
                            .addComponent(txtMaNV, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)))
                    .addComponent(lblMaNV3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 32, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl)
                    .addComponent(lbl2)
                    .addComponent(lblMaNV2)
                    .addComponent(lblMaNV4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtDiachi, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtPB, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtHoten, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(3, 3, 3)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblMaNV, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtMaNV, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtHoten, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(14, 14, 14)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblMaNV1)
                    .addComponent(lblMaNV4)
                    .addComponent(txtDiachi, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNgaysinh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblMaNV6, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtMobi, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl2, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtEmail, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblMaNV3, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtCV, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblMaNV2, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtPB, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl1)
                    .addComponent(cboSex, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jPanel3.setName("jPanel3"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(qlytv.QLyTVApp.class).getContext().getActionMap(QLyTVView.class, this);
        btnInsert.setAction(actionMap.get("clearNhanVien")); // NOI18N
        btnInsert.setText(resourceMap.getString("btnInsert.text")); // NOI18N
        btnInsert.setName("btnInsert"); // NOI18N
        btnInsert.setPreferredSize(new java.awt.Dimension(70, 20));

        btnDelete.setAction(actionMap.get("delNhanVien")); // NOI18N
        btnDelete.setText(resourceMap.getString("btnDelete.text")); // NOI18N
        btnDelete.setName("btnDelete"); // NOI18N
        btnDelete.setPreferredSize(new java.awt.Dimension(70, 20));

        btnSearch.setAction(actionMap.get("findNhanVien")); // NOI18N
        btnSearch.setText(resourceMap.getString("btnSearch.text")); // NOI18N
        btnSearch.setName("btnSearch"); // NOI18N

        btnSave.setAction(actionMap.get("insNhanVien")); // NOI18N
        btnSave.setText(resourceMap.getString("btnSave.text")); // NOI18N
        btnSave.setName("btnSave"); // NOI18N

        btnUpdate.setAction(actionMap.get("updNhanVien")); // NOI18N
        btnUpdate.setText(resourceMap.getString("btnUpdate.text")); // NOI18N
        btnUpdate.setName("btnUpdate"); // NOI18N
        btnUpdate.setPreferredSize(new java.awt.Dimension(70, 20));

        jButton2.setAction(actionMap.get("quit")); // NOI18N
        jButton2.setName("jButton2"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnInsert, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .addComponent(btnSearch, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .addComponent(btnDelete, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .addComponent(btnSave, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .addComponent(btnUpdate, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .addComponent(jButton2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(btnInsert, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnUpdate, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
                .addGap(5, 5, 5)
                .addComponent(btnDelete, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnSave)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton2)
                .addGap(11, 11, 11))
        );

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        tblNhanVien.setName("tblNhanVien"); // NOI18N
        tblNhanVien.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblNhanVienMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tblNhanVien);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 707, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(20, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(44, 44, 44)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(19, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(45, 45, 45))
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel1.TabConstraints.tabTitle"), jPanel1); // NOI18N

        jPanel5.setName("jPanel5"); // NOI18N

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel6.border.title"))); // NOI18N
        jPanel6.setName("jPanel6"); // NOI18N

        lbl3.setText(resourceMap.getString("lbl3.text")); // NOI18N
        lbl3.setName("lbl3"); // NOI18N

        txtHoten1.setName("txtHoten1"); // NOI18N

        lblMaNV7.setText(resourceMap.getString("lblMaNV7.text")); // NOI18N
        lblMaNV7.setName("lblMaNV7"); // NOI18N

        lblMaNV8.setText(resourceMap.getString("lblMaNV8.text")); // NOI18N
        lblMaNV8.setName("lblMaNV8"); // NOI18N

        txtDiachi1.setName("txtDiachi1"); // NOI18N

        lblMaNV9.setText(resourceMap.getString("lblMaNV9.text")); // NOI18N
        lblMaNV9.setName("lblMaNV9"); // NOI18N

        txtMobi1.setName("txtMobi1"); // NOI18N

        lbl4.setText(resourceMap.getString("lbl4.text")); // NOI18N
        lbl4.setName("lbl4"); // NOI18N

        txtEmail1.setName("txtEmail1"); // NOI18N

        lblMaNV10.setText(resourceMap.getString("lblMaNV10.text")); // NOI18N
        lblMaNV10.setName("lblMaNV10"); // NOI18N

        lblMaNV11.setText(resourceMap.getString("lblMaNV11.text")); // NOI18N
        lblMaNV11.setName("lblMaNV11"); // NOI18N

        txtTTThe.setName("txtTTThe"); // NOI18N

        lbl5.setText(resourceMap.getString("lbl5.text")); // NOI18N
        lbl5.setName("lbl5"); // NOI18N

        cboSex1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Nam", "Nữ", "" }));
        cboSex1.setName("cboSex1"); // NOI18N

        txtNgaysinh1.setName("txtNgaysinh1"); // NOI18N

        txtMaThe.setText(resourceMap.getString("txtMaThe.text")); // NOI18N
        txtMaThe.setName("txtMaThe"); // NOI18N

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbl3)
                            .addComponent(lblMaNV7))
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtHoten1, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addGap(35, 35, 35)
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtNgaysinh1)
                                    .addComponent(txtMobi1, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)))))
                    .addComponent(lblMaNV9)
                    .addComponent(lbl5)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(86, 86, 86)
                        .addComponent(cboSex1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl4)
                    .addComponent(lblMaNV10)
                    .addComponent(lblMaNV11)
                    .addComponent(lblMaNV8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtMaThe)
                    .addComponent(txtTTThe, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
                    .addComponent(txtEmail1, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
                    .addComponent(txtDiachi1, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl3, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtHoten1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblMaNV8, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtDiachi1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblMaNV7, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtNgaysinh1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl4, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtEmail1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblMaNV9)
                    .addComponent(txtMobi1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblMaNV10)
                    .addComponent(txtMaThe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl5, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cboSex1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblMaNV11, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtTTThe, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31))
        );

        jPanel7.setName("jPanel7"); // NOI18N

        btnInsert1.setAction(actionMap.get("clearDocGia")); // NOI18N
        btnInsert1.setText(resourceMap.getString("btnInsert1.text")); // NOI18N
        btnInsert1.setName("btnInsert1"); // NOI18N
        btnInsert1.setPreferredSize(new java.awt.Dimension(70, 20));

        btnDelete1.setAction(actionMap.get("delDocGia")); // NOI18N
        btnDelete1.setText(resourceMap.getString("btnDelete1.text")); // NOI18N
        btnDelete1.setName("btnDelete1"); // NOI18N
        btnDelete1.setPreferredSize(new java.awt.Dimension(70, 20));

        btnSearch1.setAction(actionMap.get("findDocgia")); // NOI18N
        btnSearch1.setText(resourceMap.getString("btnSearch1.text")); // NOI18N
        btnSearch1.setName("btnSearch1"); // NOI18N

        btnSave1.setAction(actionMap.get("insDocGia")); // NOI18N
        btnSave1.setText(resourceMap.getString("btnSave1.text")); // NOI18N
        btnSave1.setName("btnSave1"); // NOI18N

        btnUpdate1.setAction(actionMap.get("updDocGia")); // NOI18N
        btnUpdate1.setText(resourceMap.getString("btnUpdate1.text")); // NOI18N
        btnUpdate1.setName("btnUpdate1"); // NOI18N
        btnUpdate1.setPreferredSize(new java.awt.Dimension(70, 20));

        jButton3.setAction(actionMap.get("quit")); // NOI18N
        jButton3.setName("jButton3"); // NOI18N

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnSearch1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .addComponent(btnInsert1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .addComponent(btnDelete1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .addComponent(btnSave1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .addComponent(btnUpdate1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                    .addComponent(jButton3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(btnInsert1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnUpdate1, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
                .addGap(5, 5, 5)
                .addComponent(btnDelete1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnSearch1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnSave1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton3)
                .addGap(13, 13, 13))
        );

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        tblDocGia.setName("tblDocGia"); // NOI18N
        tblDocGia.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblDocGiaMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tblDocGia);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 707, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(39, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel7, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(44, 44, 44)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(58, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 761, Short.MAX_VALUE)
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 479, Short.MAX_VALUE)
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        mnuDMPB.setAction(actionMap.get("showPhongBan")); // NOI18N
        mnuDMPB.setText(resourceMap.getString("mnuDMPB.text")); // NOI18N
        mnuDMPB.setName("mnuDMPB"); // NOI18N
        jMenu2.add(mnuDMPB);

        mnuDMThe.setAction(actionMap.get("showThe")); // NOI18N
        mnuDMThe.setText(resourceMap.getString("mnuDMThe.text")); // NOI18N
        mnuDMThe.setName("mnuDMThe"); // NOI18N
        jMenu2.add(mnuDMThe);

        jMenu1.add(jMenu2);

        menuBar.add(jMenu1);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 761, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 591, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents

    private void tblNhanVienMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblNhanVienMouseClicked
        int rows = tblNhanVien.getSelectedRow();
        //set text with select rows

        txtMaNV.setText((String) tblNhanVien.getModel().getValueAt(rows, 0));
        txtHoten.setText((String) tblNhanVien.getModel().getValueAt(rows, 1));
        txtNgaysinh.setText((String) tblNhanVien.getModel().getValueAt(rows, 2));
        txtDiachi.setText((String) tblNhanVien.getModel().getValueAt(rows, 3));

        txtMobi.setText((String) tblNhanVien.getModel().getValueAt(rows, 4));
        txtEmail.setText((String) tblNhanVien.getModel().getValueAt(rows, 5));
        txtCV.setText((String) tblNhanVien.getModel().getValueAt(rows, 6));
        txtPB.setText((String) tblNhanVien.getModel().getValueAt(rows, 7));
        if (tblNhanVien.getModel().getValueAt(rows, 8).equals("Nữ")) {
            cboSex.setSelectedIndex(1);
        } else {
            cboSex.setSelectedIndex(0);
        }

    }//GEN-LAST:event_tblNhanVienMouseClicked

    private void tblDocGiaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblDocGiaMouseClicked
              
        int rows = tblDocGia.getSelectedRow();
        //set text with select rows
        
        txtHoten1.setText((String) tblDocGia.getModel().getValueAt(rows, 0));
        txtNgaysinh1.setText((String) tblDocGia.getModel().getValueAt(rows, 1));
        txtDiachi1.setText((String) tblDocGia.getModel().getValueAt(rows, 2));
        txtMobi1.setText((String) tblDocGia.getModel().getValueAt(rows, 3));
        txtEmail1.setText((String) tblDocGia.getModel().getValueAt(rows, 4));        
        if (tblDocGia.getModel().getValueAt(rows, 5).equals("Nữ")) {
            cboSex1.setSelectedIndex(1);
        } else {
            cboSex1.setSelectedIndex(0);
        }        
        txtMaThe.setText((String) tblDocGia.getModel().getValueAt(rows, 6));
        txtTTThe.setText((String) tblDocGia.getModel().getValueAt(rows, 7));
        
    }//GEN-LAST:event_tblDocGiaMouseClicked
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JButton btnDelete;
    public static javax.swing.JButton btnDelete1;
    public static javax.swing.JButton btnInsert;
    public static javax.swing.JButton btnInsert1;
    public static javax.swing.JButton btnSave;
    public static javax.swing.JButton btnSave1;
    public static javax.swing.JButton btnSearch;
    public static javax.swing.JButton btnSearch1;
    public static javax.swing.JButton btnUpdate;
    public static javax.swing.JButton btnUpdate1;
    public static javax.swing.JComboBox cboSex;
    public static javax.swing.JComboBox cboSex1;
    public static javax.swing.JButton jButton2;
    public static javax.swing.JButton jButton3;
    public static javax.swing.JMenu jMenu1;
    public static javax.swing.JMenu jMenu2;
    public static javax.swing.JPanel jPanel1;
    public static javax.swing.JPanel jPanel2;
    public static javax.swing.JPanel jPanel3;
    public static javax.swing.JPanel jPanel4;
    public static javax.swing.JPanel jPanel5;
    public static javax.swing.JPanel jPanel6;
    public static javax.swing.JPanel jPanel7;
    public static javax.swing.JScrollPane jScrollPane1;
    public static javax.swing.JScrollPane jScrollPane2;
    public static javax.swing.JTabbedPane jTabbedPane1;
    public static javax.swing.JLabel lbl;
    public static javax.swing.JLabel lbl1;
    public static javax.swing.JLabel lbl2;
    public static javax.swing.JLabel lbl3;
    public static javax.swing.JLabel lbl4;
    public static javax.swing.JLabel lbl5;
    public static javax.swing.JLabel lblMaNV;
    public static javax.swing.JLabel lblMaNV1;
    public static javax.swing.JLabel lblMaNV10;
    public static javax.swing.JLabel lblMaNV11;
    public static javax.swing.JLabel lblMaNV2;
    public static javax.swing.JLabel lblMaNV3;
    public static javax.swing.JLabel lblMaNV4;
    public static javax.swing.JLabel lblMaNV6;
    public static javax.swing.JLabel lblMaNV7;
    public static javax.swing.JLabel lblMaNV8;
    public static javax.swing.JLabel lblMaNV9;
    public static javax.swing.JPanel mainPanel;
    public static javax.swing.JMenuBar menuBar;
    public static javax.swing.JMenuItem mnuDMPB;
    public static javax.swing.JMenuItem mnuDMThe;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    public static javax.swing.JPanel statusPanel;
    public static javax.swing.JTable tblDocGia;
    public static javax.swing.JTable tblNhanVien;
    public static javax.swing.JTextField txtCV;
    public static javax.swing.JTextField txtDiachi;
    public static javax.swing.JTextField txtDiachi1;
    public static javax.swing.JTextField txtEmail;
    public static javax.swing.JTextField txtEmail1;
    public static javax.swing.JTextField txtHoten;
    public static javax.swing.JTextField txtHoten1;
    public static javax.swing.JTextField txtMaNV;
    public static javax.swing.JTextField txtMaThe;
    public static javax.swing.JTextField txtMobi;
    public static javax.swing.JTextField txtMobi1;
    public static javax.swing.JTextField txtNgaysinh;
    public static javax.swing.JTextField txtNgaysinh1;
    public static javax.swing.JTextField txtPB;
    public static javax.swing.JTextField txtTTThe;
    // End of variables declaration//GEN-END:variables
    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;
    private JDialog aboutBox;
    private JDialog showPhongBan;
    private JDialog showThe;
}
